Loading...
 

CX_PERIODIC_DATE - Periodic date

CX_PERIODIC_DATE  CX_PERIODIC_DATE.png

Class hierarchy
Description:

This class can be used to represent a periodic date, i.e. a period of time that repeats itself in a certain way. In the following, some possible date specifications which can be realised with an object of this class are shown, including generation notes. The description of all possible date specifications can be found in the description of the Import function.

Code example:

In dem Beispiel wird ein Eingabefeld vom Typ Radiobutton an den Wochentag "Montag" gekoppelt. Der "Montag" wird bei DrainWindow gesetzt, falls das Eingabefeld einen Wert ungleich Null enthält, und zurückgesetzt, falls es den Wert Null enthält. Bei FillWindow wird äquivalent entweder eine "1" oder "0" an das Eingabefeld übergeben.

Radio(CX_PERIODIC_DATE::Mondays(), 10, 10, 125, T("Montag", "Monday"))


Zusätzlich hierzu gibt es noch die Funktion WeekdayEnumMA(), die es erlaubt, den internen Wert eines Wochentages bzw. einer Wochentagkombination zu setzen. Werden z.B. häufig komplizierte Wochentagkombinationen wie "Montags, Mittwochs, Donnerstags und Sonntags" oder "Montags bis Freitags" gebraucht, so wäre es mühsam diese mit den bisher vorgestellten Hilfsmitteln einzugeben. Für solche Fälle kann man die internen Werte in einer Datei Texten zuordnen, wie beispielhaft in der folgenden Datei "weekdays.enm" (Näheres zu der internen Darstellung steht in der Dokumentation der Funktion Import):

366, T(Montags, Mondays), 0xff
367, T(Dienstags, Tuesdays), 0xff
369, T(Mittwochs, Wednesdays), 0xff
373, T(Donnerstags, Thursdays), 0xff
381, T(Freitags, Fridays), 0xff
397, T(Samstags, Saturdays), 0xff
329, T(Sonntags, Sundays), 0xff
396, T("Montags bis Freitags", "Mondays to Fridays"), 0xff
461, T("Samstags und Sonntags", "Saturdays and Sundays"), 0xff
442, T("Mo, Mi, Do und So", "Mon, Wed, Thu and Sun"), 0xff
492, T("jeder Wochentag", "each weekday"), 0xff
941, T("Sonn- und Feiertags", "Sundays and Holidays"), 0xff

Die Zugriffsfunktion WeekdayEnumMA() wird dabei an ein Eingabefeld vom Typ Enumeration gekoppelt.

Enumeration(CX_PERIODIC_DATE::WeekdayEnumMA(), 10, 10, 115, 40, "weekdays.enm")

1) "The second Monday of every month".

Note: This periodic date should not be confused with "Every second Monday of every month from the nth Monday of the month".

 pdate01.jpg

see also MthWeekdayInMonth

2. from Monday to Friday

 pdate02.jpg

see also NthWeekdayFromTheKthInMonth

3. on the penultimate Monday of each month

 pdate03.jpg

see also MthWeekdayInMonth

4 "From every 15th to 17th

 pdate04.jpg

see also NthDayFromKthMonthand Setting the individual period duration

5 "On the 300th day of every year"

 pdate05.jpg

see also MthDayInEachYear

6) "On each last day of the month including the next 3 days".

 pdate06.jpg

see also NthDayFromKthMonth and setting the single period duration

Display on screen

In contrast to classes such as CX_DATE , a periodic date does not have its own interface object. Instead, the user can design an input mask adapted for his purposes, the contents of which are placed in the object via the available access functions. As an example, an input mask for entering (any) weekday combinations is shown below. Using the radio buttons, the user can generate a periodic date, such as "Wednesdays, Thursdays and Sundays" in the figure (see also programme code).

 dpdate7.gif

If "standard periods" are often used, such as "From Monday to Friday" or "On weekends", the recording can be further simplified by using other input fields, as shown in the following figure (programme code).

 dpdate8.gif

Operators
Operator Brief description
>, < and = Comparison of a periodic date with another date

List of methods (MDI)
Function MA* Parameters Return Brief description
AndHolidays "and holidays"
AndNoHolidays "and not a holiday"
BeforeLastWeekday * Setting the "penultimate day of the period".
DateGranularity * Set date reference period
Day * Setting a special day
DayConsistsOfWeekdays Does the date include a day of the week?
DayIsASpecialDay Does the date include a day?
Frequency * Setting the frequency
Fridays * Setting the Friday
GenerateDays (OBJECT, OBJECT) COLL Tag generation
GetWeekdayPattern OBJECT Preservation of the bit pattern to determine the set weekdays. from DLL version 180199
Granularity * Setting the reference period
Import (INTEGER, OBJECT, INTEGER, INTEGER, INTEGER, INTEGER) Import of a periodic date
IsCompact INTEGER Is the date "compact"?
IsUndef INTEGER Is the date undefined?
LastWeekday * Set the "last day of the week of the period".
Mondays * Setting the Monday
MonthGranularity * Set monthly reference period
MthBeforeLastDayOfMonthInYear (INTEGER, INTEGER) "the penultimate day of the week of the mth month of the year"
MthDayInEachYear (INTEGER, INTEGER) "m.th day of the year"
MthLastDayOfMonthInYear (INTEGER, INTEGER) "last day of the week of the m.th month of the year"
MthWeekdayInMonth (INTEGER, INTEGER) "m.ter weekday in the month"
MthWeekdayInYear (INTEGER, INTEGER) "m.ter weekday in the year"
NthDayFromDate (INTEGER, INTEGER, OBJECT) "n.th day from date"
NthDayFromKthMonth (INTEGER, INTEGER, INTEGER) "n.th day of the month"
NthWeekdayFromDate (INTEGER, INTEGER, OBJECT) "n.th weekday from date"
NthWeekdayFromTheKthInMonth (INTEGER, INTEGER, INTEGER) "n.th day of the week from the k.th in the same month"
NthWeekdayFromTheKthInYear (INTEGER, INTEGER, INTEGER) "n.th day of the week from the k.th in the same year"
OrHolidays "or holiday"
OrNoHolidays "or not a holiday"
Position * Setting a specific position
Saturdays * Setting the Saturday
SetPeriodicDate
231532
STRING, INTEGER Import periodic date from the passed string.
ShortImport (INTEGER, INTEGER) Import of a periodic date
Sundays * Setting the Sunday
Thursdays * Setting Thursday
Tuesdays * Setting the Tuesday
last trading day * Setting the last day of the month
Undef Create undefined date
VDuration * Setting the individual period duration
VDuration0 * Setting a day duration

Wednesdays

* Setting the Wednesday
WeekdayEnum INTEGER Querying the internal value of the weekday combination
WeekdayEnumMA * Setting a weekday combination, querying the enum
WeekdayStart * Setting a start date
YearGranularity * Set annual reference period
Encompassed (OBJECT) INTEGER Test whether one date period is completely within another.
EndOfPeriod OBJECT Return: the end date of a date period
NextDate (OBJECT, OBJECT) OBJECT the following day within the date period
NextTerm (OBJECT) OBJECT the following day within the date period
Overlap (OBJECT) INTEGER Test whether a current date or another date period overlaps with the date period.
RealEndOfPeriod OBJECT The later of the border periods
RealStartOfPeriod OBJECT The earlier of the border periods
SetDate
231532
STRING, INTEGER Import start date of the periodic date from the passed string.
SetSpanDate
231532
STRING, INTEGER Import the start date and the single period duration from the passed string.
StartOfPeriod OBJECT Start of period
string INTEGER CX_STRING Returns the string representation of the object

* MA = Member Access Function

Data directory (DDI)
Data field Type Reference class I* Brief description
dayDescription INTEGER internal description

Use in AppsWH
Module Brief description
wrldclck.mod World clock basic module
perdate.mod Periodic date Test module